---
layout: "default"
title: "Operator: !="
description: "Swift documentation for the '!=' operator."
root: "/v2.1"
---

<code class="language-swift">infix operator != {
    associativity none
    precedence 130
}</code>

<h3>Declarations</h3>

<div class="declaration" id="func-excleq_-double-rhs_-double">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-double-rhs_-double">func !=(<wbr>_:<wbr> Double, rhs: Double)</a>
        
<div class="comment collapse" id="comment-func-excleq_-double-rhs_-double"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Double, rhs: Double) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-float-rhs_-float">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-float-rhs_-float">func !=(<wbr>_:<wbr> Float, rhs: Float)</a>
        
<div class="comment collapse" id="comment-func-excleq_-float-rhs_-float"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Float, rhs: Float) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-float80-rhs_-float80">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-float80-rhs_-float80">func !=(<wbr>_:<wbr> Float80, rhs: Float80)</a>
        
<div class="comment collapse" id="comment-func-excleq_-float80-rhs_-float80"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Float80, rhs: Float80) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-int-rhs_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-int-rhs_-int">func !=(<wbr>_:<wbr> Int, rhs: Int)</a>
        
<div class="comment collapse" id="comment-func-excleq_-int-rhs_-int"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Int, rhs: Int) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-int8-rhs_-int8">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-int8-rhs_-int8">func !=(<wbr>_:<wbr> Int8, rhs: Int8)</a>
        
<div class="comment collapse" id="comment-func-excleq_-int8-rhs_-int8"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Int8, rhs: Int8) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-int16-rhs_-int16">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-int16-rhs_-int16">func !=(<wbr>_:<wbr> Int16, rhs: Int16)</a>
        
<div class="comment collapse" id="comment-func-excleq_-int16-rhs_-int16"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Int16, rhs: Int16) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-int32-rhs_-int32">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-int32-rhs_-int32">func !=(<wbr>_:<wbr> Int32, rhs: Int32)</a>
        
<div class="comment collapse" id="comment-func-excleq_-int32-rhs_-int32"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Int32, rhs: Int32) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-int64-rhs_-int64">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-int64-rhs_-int64">func !=(<wbr>_:<wbr> Int64, rhs: Int64)</a>
        
<div class="comment collapse" id="comment-func-excleq_-int64-rhs_-int64"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: Int64, rhs: Int64) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-uint-rhs_-uint">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-uint-rhs_-uint">func !=(<wbr>_:<wbr> UInt, rhs: UInt)</a>
        
<div class="comment collapse" id="comment-func-excleq_-uint-rhs_-uint"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: UInt, rhs: UInt) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-uint8-rhs_-uint8">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-uint8-rhs_-uint8">func !=(<wbr>_:<wbr> UInt8, rhs: UInt8)</a>
        
<div class="comment collapse" id="comment-func-excleq_-uint8-rhs_-uint8"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: UInt8, rhs: UInt8) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-uint16-rhs_-uint16">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-uint16-rhs_-uint16">func !=(<wbr>_:<wbr> UInt16, rhs: UInt16)</a>
        
<div class="comment collapse" id="comment-func-excleq_-uint16-rhs_-uint16"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: UInt16, rhs: UInt16) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-uint32-rhs_-uint32">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-uint32-rhs_-uint32">func !=(<wbr>_:<wbr> UInt32, rhs: UInt32)</a>
        
<div class="comment collapse" id="comment-func-excleq_-uint32-rhs_-uint32"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: UInt32, rhs: UInt32) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-uint64-rhs_-uint64">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-uint64-rhs_-uint64">func !=(<wbr>_:<wbr> UInt64, rhs: UInt64)</a>
        
<div class="comment collapse" id="comment-func-excleq_-uint64-rhs_-uint64"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(lhs: UInt64, rhs: UInt64) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq_-any-type-t1_-any-type">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq_-any-type-t1_-any-type">func !=(<wbr>_:<wbr> Any.Type?, t1: Any.Type?)</a>
        
<div class="comment collapse" id="comment-func-excleq_-any-type-t1_-any-type"><div class="p">
    <p>Return <code>false</code> iff <code>t0</code> is identical to <code>t1</code>; i.e. if they are both
<code>nil</code> or they both represent the same type.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func !=(t0: Any.Type?, t1: Any.Type?) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-element_-equatable_-element-rhs_-element">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-element_-equatable_-element-rhs_-element">func <wbr>!= &lt;Element : Equatable&gt;(<wbr>_:<wbr> [Element], rhs: [Element])</a>
        
<div class="comment collapse" id="comment-func-excleq-element_-equatable_-element-rhs_-element"><div class="p">
    <p>Returns true if the arrays do not contain the same elements.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;Element : Equatable&gt;(lhs: [Element], rhs: [Element]) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-element_-equatable_-arrayslice-element-rhs_-arrayslice-element">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-element_-equatable_-arrayslice-element-rhs_-arrayslice-element">func <wbr>!= &lt;Element : Equatable&gt;(<wbr>_:<wbr> ArraySlice&lt;Element&gt;, rhs: ArraySlice&lt;Element&gt;)</a>
        
<div class="comment collapse" id="comment-func-excleq-element_-equatable_-arrayslice-element-rhs_-arrayslice-element"><div class="p">
    <p>Returns true if the arrays do not contain the same elements.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;Element : Equatable&gt;(lhs: ArraySlice&lt;Element&gt;, rhs: ArraySlice&lt;Element&gt;) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-element_-equatable_-contiguousarray-element-rhs_-contiguousarray-element">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-element_-equatable_-contiguousarray-element-rhs_-contiguousarray-element">func <wbr>!= &lt;Element : Equatable&gt;(<wbr>_:<wbr> ContiguousArray&lt;Element&gt;, rhs: ContiguousArray&lt;Element&gt;)</a>
        
<div class="comment collapse" id="comment-func-excleq-element_-equatable_-contiguousarray-element-rhs_-contiguousarray-element"><div class="p">
    <p>Returns true if the arrays do not contain the same elements.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;Element : Equatable&gt;(lhs: ContiguousArray&lt;Element&gt;, rhs: ContiguousArray&lt;Element&gt;) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-key_-equatable-value_-equatable_-key_-value-rhs_-key_-value">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-key_-equatable-value_-equatable_-key_-value-rhs_-key_-value">func <wbr>!= &lt;Key :<wbr> Equatable, Value : Equatable&gt;(<wbr>_:<wbr> [Key :<wbr> Value], rhs:<wbr> [Key : Value])</a>
        
<div class="comment collapse" id="comment-func-excleq-key_-equatable-value_-equatable_-key_-value-rhs_-key_-value"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;Key : Equatable, Value : Equatable&gt;(lhs: [Key : Value], rhs: [Key : Value]) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-t_-equatable-where-t_-rawrepresentable-t-rawvalue_-equatable_-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-t_-equatable-where-t_-rawrepresentable-t-rawvalue_-equatable_-t-rhs_-t">func <wbr>!= &lt;T :<wbr> Equatable where T :<wbr> RawRepresentable, T.RawValue : Equatable&gt;(<wbr>_:<wbr> T, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-excleq-t_-equatable-where-t_-rawrepresentable-t-rawvalue_-equatable_-t-rhs_-t"><div class="p">
    <p>Returns <code>true</code> iff <code>lhs.rawValue != rhs.rawValue</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;T : Equatable where T : RawRepresentable, T.RawValue : Equatable&gt;(lhs: T, rhs: T) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-t_-equatable_-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-t_-equatable_-t-rhs_-t">func <wbr>!= &lt;T : Equatable&gt;(<wbr>_:<wbr> T, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-excleq-t_-equatable_-t-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;T : Equatable&gt;(lhs: T, rhs: T) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-t_-equatable_-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-t_-equatable_-t-rhs_-t">func <wbr>!= &lt;T : Equatable&gt;(<wbr>_:<wbr> T?, rhs: T?)</a>
        
<div class="comment collapse" id="comment-func-excleq-t_-equatable_-t-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;T : Equatable&gt;(lhs: T?, rhs: T?) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-t_-rawrepresentable-where-t-rawvalue_-equatable_-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-t_-rawrepresentable-where-t-rawvalue_-equatable_-t-rhs_-t">func <wbr>!= &lt;T :<wbr> RawRepresentable where T.RawValue : Equatable&gt;(<wbr>_:<wbr> T, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-excleq-t_-rawrepresentable-where-t-rawvalue_-equatable_-t-rhs_-t"><div class="p">
    <p>Returns <code>true</code> iff <code>lhs.rawValue != rhs.rawValue</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;T : RawRepresentable where T.RawValue : Equatable&gt;(lhs: T, rhs: T) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-t_-optionalnilcomparisontype-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-t_-optionalnilcomparisontype-rhs_-t">func != &lt;T&gt;(<wbr>_:<wbr> _OptionalNilComparisonType, rhs: T?)</a>
        
<div class="comment collapse" id="comment-func-excleq-t_-optionalnilcomparisontype-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;T&gt;(lhs: _OptionalNilComparisonType, rhs: T?) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-excleq-t_-t-rhs_-optionalnilcomparisontype">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-excleq-t_-t-rhs_-optionalnilcomparisontype">func != &lt;T&gt;(<wbr>_:<wbr> T?, rhs: _OptionalNilComparisonType)</a>
        
<div class="comment collapse" id="comment-func-excleq-t_-t-rhs_-optionalnilcomparisontype"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func !=&lt;T&gt;(lhs: T?, rhs: _OptionalNilComparisonType) -&gt; Bool</code>
    
    
</div></div>
</div>
